//
//  HMTryReadTableViewCell.m
//  HowToDo
//
//  Created by 宋轩 on 17/1/4.
//  Copyright © 2017年 KY. All rights reserved.
//

#import "HMTryReadTableViewCell.h"

@interface HMTryReadTableViewCell ()
@property (weak, nonatomic) IBOutlet UILabel *item_titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *read_count;
@property (weak, nonatomic) IBOutlet UILabel *add_timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *like_count;
@property (weak, nonatomic) IBOutlet UIImageView *item_image_urlImageView;
@property (weak, nonatomic) IBOutlet UILabel *item_introduceLabel;
@property(copy,nonatomic)NSString *tryReadID;



@end

@implementation HMTryReadTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setTryReadModel:(HMTryReadModel *)tryReadModel
{
    _tryReadModel = tryReadModel;
    self.item_titleLabel.text = tryReadModel.item_title;
    self.read_count.text = [NSString stringWithFormat:@"%@人阅读", tryReadModel.read_count == NULL ? @"0" : tryReadModel.read_count];
//    self.add_timeLabel.text = tryReadModel.add_time;
    
    //日期转换
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = @"MM月dd日";
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:tryReadModel.add_time.intValue];
    self.add_timeLabel.text = [formatter stringFromDate:date];
    
    self.like_count.text = tryReadModel.like_count;
    [self.item_image_urlImageView sd_setImageWithURL:[NSURL URLWithString:tryReadModel.item_image_url] placeholderImage:[UIImage imageNamed:@"placeHolder"]];
    self.item_image_urlImageView.clipsToBounds = YES;
    self.item_introduceLabel.text = tryReadModel.item_introduce;
    
    self.tryReadID = tryReadModel.tryReadID;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
